package controller

import (
	"github.com/gin-gonic/gin"
	"ytdownloader-api/config"
	"ytdownloader-api/downloader"
	"ytdownloader-api/models"
)

func GetAllVideos(c *gin.Context) {
	db := config.GetDB()
	var videos models.VideoRecord
	db.Model(&models.VideoRecord{}).Find(&videos)
	c.JSON(200, videos)
}

func ParseUrl(c *gin.Context) {
	c.String(200, "Hello World")
	return
	url := c.Query("url")
	youtube := downloader.GetDownloader()
	video, err := youtube.GetVideo(url)
	if err != nil {
		c.JSON(500, err.Error())
		return
	}
	c.JSON(200, video)
}

func CreateVideo(c *gin.Context) {

}

func DeleteVideo(c *gin.Context) {

}

func UpdateVideo(c *gin.Context) {

}
